//
//  HomepageCouponCollectionViewCell.m
//  JiuJiuShangCheng
//
//  Created by jiujiukeji on 2018/7/30.
//  Copyright © 2018年 jiujiukeji. All rights reserved.
//

#import "HomepageCouponCollectionViewCell.h"

@implementation HomepageCouponCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setUpUI];
    }
    return self;
}
- (void)setUpUI
{
    self.couponImg = [[UIImageView alloc] init];
    _couponImg.image = UIImageNamed(@"couponCheng"); // couponHuang
    [_couponImg sizeToFit];
    [self addSubview:_couponImg];
    [_couponImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self);
    }];
    
    self.lingQuBtn = [UIButton buttonWithTitle:@"立即领取>" fontSize:10 titleColor:globalOrange background:UIColorWhite cornerRadius:0];
    [self.couponImg addSubview:_lingQuBtn];
    [_lingQuBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.couponImg).offset(-rateWidth(25));
        make.centerX.equalTo(self.couponImg);
        make.size.mas_offset(CGSizeMake(rateWidth(250), rateWidth(30)));
    }];
    
    UILabel *label = [UILabel labelWithText:@"￥" textColor:UIColorWhite fontSize:15];
    [label sizeToFit];
    [self.couponImg addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.lingQuBtn.mas_top).offset(-rateWidth(10));
        make.left.equalTo(self.lingQuBtn);
    }];
    
    self.moneyLB = [UILabel labelWithText:@"50" textColor:UIColorWhite fontSize:35];
    [_moneyLB sizeToFit];
    [self.couponImg addSubview:_moneyLB];
    [_moneyLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(label);
        make.left.equalTo(label.mas_right).offset(rateWidth(5));
    }];
    
    UILabel *label1 = [UILabel labelWithText:@"优惠券" textColor:UIColorWhite fontSize:16];
    [label1 sizeToFit];
    [self.couponImg addSubview:label1];
    [label1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(label);
        make.left.equalTo(self.moneyLB.mas_right).offset(rateWidth(5));
    }];
    
    self.conditionLB = [UILabel labelWithText:@"满99元使用" textColor:UIColorWhite fontSize:12];
    [self.conditionLB sizeToFit];
    [self.couponImg addSubview:self.conditionLB];
    [self.conditionLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(label1);
        make.bottom.equalTo(label1.mas_top).offset(-rateWidth(10));
    }];
    
}

@end
